package service;

import dao.DepartmentDaoImpl;
import dao.DepartmentDaoInterface;
import entity.Department;
import util.JdbcHelper;

import java.sql.Connection;
import java.sql.SQLException;

public class DepartmentService implements DepartmentServiceInterface {
    private DepartmentService(){};
    private static DepartmentService departmentService;
    public static DepartmentService getInstance(){
        if(departmentService==null){
           departmentService=new DepartmentService();
        }
        return departmentService;
    }
    private DepartmentDaoInterface dao=DepartmentDaoImpl.getInstance();
    @Override
    public Department find(Long id) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        return dao.find(connection,id);
    }
}
